package o;

import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import o.aws.d;
import o.awx.a;
import o.axa.b;
import o.axa.c;
import o.axa.f;
import o.axa.h;
import o.ayo.e;

public class ayk extends Fragment {
    private boolean ˏ;

    public void ˋ(boolean z) {
        this.ˏ = z;
    }

    @Nullable
    public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, Bundle bundle) {
        super.onCreateView(layoutInflater, viewGroup, bundle);
        View view = null;
        awr ॱ = axg.ˏ().ॱ();
        if (ॱ != null) {
            if (this.ˏ) {
                view = (ViewGroup) layoutInflater.inflate(f.ʻ, viewGroup, false);
                azb.ˏ(view, b.ˍ);
                awq ॱ2 = ॱ.ॱ();
                if (ॱ2 != null) {
                    ॱ(ॱ2.ˏ());
                }
                ˊ(view);
            } else {
                ViewGroup viewGroup2 = (ViewGroup) layoutInflater.inflate(f.ॱ, viewGroup, false);
                azb.ˏ(viewGroup2, b.ˍ);
                aws ˊ = ॱ.ˊ();
                if (ˊ != null) {
                    ॱ(ˊ.ˎ());
                }
                ˋ(viewGroup2);
            }
        }
        return view;
    }

    protected void ॱ(String str) {
        View findViewById = getActivity().findViewById(b.ˋᐝ);
        azb.ˏ(findViewById);
        TextView textView = (TextView) getActivity().findViewById(b.ˎˎ);
        if (azc.ˎ().ॱ() >= 21) {
            findViewById.setVisibility(8);
            ˋ(str);
        } else {
            if (dof.ॱ(str)) {
                textView.setText(h.ˋ);
            } else {
                textView.setText(str);
            }
            ˏ();
        }
        cgv.ˋ(getActivity(), c.ˎ, c.ˏ);
    }

    private void ˋ(String str) {
        ActionBar actionBar = getActivity().getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayOptions(12);
            actionBar.setDisplayShowCustomEnabled(false);
            actionBar.show();
            if (dof.ॱ(str)) {
                actionBar.setTitle(h.ˋ);
            } else {
                actionBar.setTitle(str);
            }
        }
    }

    private void ˏ() {
        ActionBar actionBar = getActivity().getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        getActivity().findViewById(b.ʽ).setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ayk ˊ;

            {
                this.ˊ = r1;
            }

            public void onClick(View view) {
                this.ˊ.getActivity().onBackPressed();
            }
        });
    }

    private void ˊ(ViewGroup viewGroup) {
        LinearLayout linearLayout = (LinearLayout) viewGroup.findViewById(b.ˋˋ);
        LinearLayout linearLayout2 = (LinearLayout) viewGroup.findViewById(b.ˋˊ);
        TextView textView = (TextView) viewGroup.findViewById(b.ˉ);
        TextView textView2 = (TextView) viewGroup.findViewById(b.ˊˋ);
        awq ॱ = axg.ˏ().ॱ().ॱ();
        if (ॱ != null) {
            textView.setText(ॱ.ˎ());
            String ॱ2 = ॱ.ॱ();
            Object ॱॱ = ॱ.ॱॱ();
            if (ॱ.ˋ() != null) {
                for (a aVar : ॱ.ˋ()) {
                    LinearLayout linearLayout3 = (LinearLayout) LayoutInflater.from(getActivity()).inflate(f.ˎ, null);
                    TextView textView3 = (TextView) linearLayout3.findViewById(b.ˊॱ);
                    ((TextView) linearLayout3.findViewById(b.ˋॱ)).setText(aVar.ˏ);
                    textView3.setText(aVar.ˊ);
                    linearLayout.addView(linearLayout3);
                }
            }
            if (ॱ.ˊ() != null) {
                for (String text : ॱ.ˊ()) {
                    textView = (TextView) LayoutInflater.from(getActivity()).inflate(f.ˋ, null);
                    textView.setText(text);
                    linearLayout2.addView(textView);
                }
            }
            CharSequence spannableString = new SpannableString(ॱॱ);
            int lastIndexOf = ॱॱ.lastIndexOf(ॱ2);
            if (lastIndexOf != -1) {
                int length = ॱ2.length() + lastIndexOf;
                ckl o_ckl = new ckl(getActivity());
                o_ckl.ˏ(new e(getActivity(), 2, false).ˎ());
                spannableString.setSpan(o_ckl, lastIndexOf, length, 33);
            }
            textView2.setText(spannableString);
            textView2.setMovementMethod(new ckl.c());
            textView2.setHighlightColor(getResources().getColor(c.ˊ));
        }
    }

    private void ˋ(ViewGroup viewGroup) {
        LinearLayout linearLayout = (LinearLayout) viewGroup.findViewById(b.ˋˋ);
        LinearLayout linearLayout2 = (LinearLayout) viewGroup.findViewById(b.ˋˊ);
        TextView textView = (TextView) viewGroup.findViewById(b.ˎ);
        TextView textView2 = (TextView) viewGroup.findViewById(b.ʼ);
        aws ˊ = axg.ˏ().ॱ().ˊ();
        if (ˊ != null) {
            Object string;
            if (ˊ.ˊ() != null) {
                for (d dVar : ˊ.ˊ()) {
                    View inflate = LayoutInflater.from(getActivity()).inflate(f.ˏ, null);
                    TextView textView3 = (TextView) inflate.findViewById(b.ॱˊ);
                    TextView textView4 = (TextView) inflate.findViewById(b.ᐝ);
                    ((ImageView) inflate.findViewById(b.ʻ)).setBackground(dVar.ॱ);
                    textView3.setText(dVar.ˋ);
                    textView4.setText(dVar.ˏ);
                    linearLayout.addView(inflate);
                }
            }
            if (ˊ.ˏ() != null) {
                for (String text : ˊ.ˏ()) {
                    TextView textView5 = (TextView) LayoutInflater.from(getActivity()).inflate(f.ˊ, null);
                    textView5.setText(text);
                    linearLayout2.addView(textView5);
                }
            }
            textView.setText(ˊ.ˋ());
            String ॱ = ˊ.ॱ();
            ˊ.ॱॱ();
            String text2 = ayn.ˏ();
            boolean isLoginSuccessful = UserSession.getInstance().isLoginSuccessful();
            if (!isLoginSuccessful || dof.ॱ(text2)) {
                awg.ˎ.ˎ("ServiceTermsActivity", "isLogin : " + isLoginSuccessful + " , is signTime empty : " + dof.ॱ(text2));
                string = getString(h.ˋॱ, new Object[]{ॱ});
            } else {
                string = getString(h.ˏॱ, new Object[]{text2, ॱ});
            }
            CharSequence spannableString = new SpannableString(string);
            int lastIndexOf = string.lastIndexOf(ॱ);
            if (lastIndexOf != -1) {
                int length = ॱ.length() + lastIndexOf;
                ckl o_ckl = new ckl(getActivity());
                o_ckl.ˏ(new e(getActivity(), 1, false).ˎ());
                spannableString.setSpan(o_ckl, lastIndexOf, length, 33);
            }
            textView2.setText(spannableString);
            textView2.setMovementMethod(new ckl.c());
            textView2.setHighlightColor(getResources().getColor(c.ˊ));
        }
    }
}
